﻿using System;
using System.Data;
using System.Data.Common;
using System.Collections.Generic;
using Runda.EShop.Common.Utility;

namespace Runda.EShop.Dal
{
    /// <summary>
    /// DAL layer class dbo.Biz_Order_Status.
    /// </summary>
    public partial class BizOrderStatusDal : DalBase
    {
        public DataTable GetAllOrderStatus(Guid OrderID)
        {
            string sql = @"
select A.*,B.CreatedAt,case when B.Status IS NULL then 0 else 1 end as ProcessStatus 
from VW_OrderStatus A LEFT JOIN Biz_Order_Status B
ON A.Status = B.Status AND B.OrderID=@OrderID";

            DbCommand dbcommand = CurrentDatabase.GetSqlStringCommand(sql);
            CurrentDatabase.AddInParameter(dbcommand, "@OrderID", DbType.Guid, OrderID);

            return CurrentDatabase.ExecuteDataSet(dbcommand).Tables[0];
        } 
    }
}
